package maze;

import java.util.ArrayList;

/**
 * @author Denis Toikka
 * 
 */
public class Maze {
	
	/**
	 * Player could enter maze only from this room.
	 */
	public Room entry = new Room();
	/**
	 * Created to avoid some problems with null pointer exception.
	 * Wall of the maze.
	 */
	public static Room wall = new Room();
	/**
	 * Created to avoid some problems with null pointer exception.
	 * Room out of maze.
	 */
	public static Room out = new Room();
	/**
	 * Maze name.
	 */
	public String name = "test maze";
	/**
	 * List of all rooms.
	 */
	public ArrayList<Room> rooms = new ArrayList<Room>();
	
	
	public void createMaze() {
		entry.name = "A4";
		Room a4 = entry;
		Room a3 = entry.createNorth("A3");
		Room b3 = a3.createEast("B3");
		Room b4 = b3.createSouth("B4");
		Room c3 = b3.createEast("C3");
		Room c4 = c3.createSouth("C4");
		Room d3 = c3.createEast("D3");
		Room d4 = d3.createSouth("D4").createExit();
		Room c2 = c3.createNorth("C2");
		Room c1 = c2.createNorth("C1");
		Room d1 = c1.createEast("D1");
		Room d2 = d1.createSouth("D2").createPortal(false, d3);
		Room b2 = c2.createWest("B2");
		Room a2 = b2.createWest("A2").createExit();
		Room b1 = b2.createNorth("B1");
		Room a1 = b1.createWest("A1").createPortal(true, c4);
		
		rooms.add(a1);
		rooms.add(a2);
		rooms.add(a3);
		rooms.add(a4);
		rooms.add(b1);
		rooms.add(b2);
		rooms.add(b3);
		rooms.add(b4);
		rooms.add(c1);
		rooms.add(c2);
		rooms.add(c3);
		rooms.add(c4);
		rooms.add(d1);
		rooms.add(d2);
		rooms.add(d3);
		rooms.add(d4);
	}
}